<extend name="Index/index"/>

<block name="box">
    <div class="view-product">

        <div class="info-center">
            <div class="manage-head">
                <h6 class="padding-left manage-head-con">{{$title}}</h6>
            </div>
        </div>
        <div class="layui-container" style="margin-top: 20px">
            <div class="layui-row">
                <if condition="empty($catelist)">
                    <h2>暂无数据</h2>
                <else/>
                    <table class="layui-table" id="table">
                        <colgroup>
                            <col width="50">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>名称</th>
                            <th>父类名称</th>
                            <th>PATH</th>
                            <th>是否显示</th>
                            <th>创建时间</th>
                            <th>修改时间</th>
                            <th id="action">操作
                                <if condition="$catelist[0]['pid'] neq 0">
                                    &nbsp;&nbsp;&nbsp;&nbsp; <a  class='layui-btn' onclick='back("{{$catelist[0].pid}}")'>返回</a>
                                </if>

                            </th>
                        </tr>
                        </thead>
                        <tbody id="category">
                        <foreach name="catelist" item="value">
                            <tr>
                                <td>{{$value.id}}</td>
                                <td>{{$value.name}}</td>
                                <td>{{$value.pid}}</td>
                                <td>{{$value.path}}</td>
                                <td>
                                    <if condition="$value.is_show eq 0">
                                        <a class="layui-icon" style="font-size: 30px; color: red;" onclick="change_category_show('{{$value.is_show}}','{{$value.id}}',this)">&#x1006;</a>
                                        <else/>
                                        <a class="layui-icon" style="font-size: 30px; color: #1E9FFF;" onclick="change_category_show('{{$value.is_show}}','{{$value.id}}',this)">&#xe618;</a>
                                    </if>
                                </td>
                                <td>{{$value.create_time}}</td>
                                <td>{{$value.update_time}}</td>
                                <td class="action">
                                    <a class="layui-btn shows" onclick="show('{{$value.id}}')">查看子类</a>
                                    <a href="{{:U('Category/addCategory',
                                    array('id'=>$value['id']))}}" class="layui-btn">添加子类</a>
                                    <a href="{{:U('Category/editCategory',
                                    array('id'=>$value['id']))}}" class="layui-btn layui-btn-normal" >编辑</a>
                                    <if condition="$value['pid'] neq 0">
                                        <a class="layui-btn layui-btn-danger" onclick="del('{{$value.id}}',this)">删除</a>
                                    </if>

                                </td>
                            </tr>
                        </foreach>

                        </tbody>
                    </table>
                </if>
            </div>
        </div>
    </div>

    <script src="__PUBLIC__/Admin/Js/admin.js"></script>
</block>